import { defineStore } from 'pinia'
import { ref } from 'vue'
//返回一个默认值为当前日期xxxx-xx格式的字符串
const getCurrentDate=() =>{
  const date = new Date()
  const year = date.getFullYear().toString()
  const month = (date.getMonth() + 1).toString().padStart(2, '0')
  console.log(year+"-"+month);
  
  return year+"-"+month
}

export const useChooseStore = defineStore('choose', () => {
  const chooseDate1 = ref("2025-04")

  const setChooseDate1 = (date: string) => {
    chooseDate1.value = date
  }
  const chooseDate2 = ref("2025-04")
    
  const setChooseDate2 = (date: string) => {
    chooseDate2.value = date
  }
  const count1=ref(0)
  const count2=ref(0)
  const setCount1=(count:number)=>{
    count1.value=count 
  }
  const setCount2=(count:number)=>{
    count2.value=count 
  }


  return {
    chooseDate1,
    chooseDate2,
    count1,
    count2,
    setChooseDate1,
    setChooseDate2,
    setCount1,
    setCount2

  }
})